import { Component, Fragment } from 'react'
import { View, Text, Image } from '@tarojs/components'
import { AtList, AtListItem } from "taro-ui"
import Taro from '@tarojs/taro'
import React from 'react';
import './mylist.scss'
class MyList extends Component{
  
    constructor (props) {
        super(props);
        this.state={
          infolist:[]
        }
      }
      //跳转页面
       //声明跳转函数
       onJump(jumpurl){
        Taro.navigateTo({url:jumpurl});
      }
      componentWillMount () { }

      componentDidMount () { 
      //使用axios完成ajax数据请求
         console.log('1111111111111111111111111111111')
         Taro.request({
          method:'GET',
          url:'http://localhost:8080/hotSpotList?hotSpotDataType=1',
          header: {
            'content-type': 'application/json' // 默认值
          },
          success:(res)=>{
            console.log(res.data.data)
            this.setState({
              infolist:res.data.data
            })
          },
          fail:function(errMsg){
            Taro.showToast({
              title:'服务器请求错误'
            })
          }
         })
         console.log('22222222222222222222222');
      }
    
      componentWillUnmount () { }
    
      componentDidShow () { }
    
      componentDidHide () { }
      
      render(){
      
          return(
            <View className='at-row at-col-12 home-hot-title-content'>
              <text className='home-hot-title'>今日热点</text>
              <View className='home-hot-more'>
                <text className='home-hot-more-title' onClick={this.onJump.bind(this,'jumppages/page4')}>更多</text>
                <View className='at-icon at-icon-chevron-right' />
              </View>
            </View>
      //       <View>
      //           {/* <View className='at-row'>
      //               <Image style='height:100px; width: 100%;' src={require("../../assets/images/redian.png") }/>
      //           </View> */}
      //       {/* <AtList>
      //         <AtListItem title='' arrow='right' extraText='更多'  onClick={this.onJump.bind(this,'jumppages/page4')}></AtListItem>
      //         {
      //           this.state.infolist.map((item,index)=>{
      //               return(
      //                 <AtListItem
      //                 title={item.hotspotTitle}
      //                 note={item.hotspotContent}
      //                 extraText={item.itemcreateat}
      //                 key={index}
      //                 hasBorder={false}
      //                 thumb={require("../../assets/images/u183.png")} 
      //                 onClick={this.onJump.bind(this,'jumppages/page4')}
      //                 ></AtListItem>
      //               )
      //           })
      //         }
      //       </AtList> */}
            
      // </View>
          )
      }
}
export default MyList